<?php
namespace Erp\C\Orders\Tn\Api;
use Erp\C\Orders\Tn\Api\ApiShippingModule;
use Fn;
class ApiIspModule extends ApiShippingModule
{
    public $url,$token,$app_key,$format,$sign_method,$version,$header;

    public function __construct()
    {
        $this->url = 'http://openapi.winit.com.cn/openapi/service';
        $this->token = 'DC38B9ADE13EF9D713BD2885C5870036';
        $this->app_key = 'winit_warehouse@cifang.hk';
        $this->format = 'json';
        $this->sign_method = 'md5';
        $this->version = '1.0';
        $this->header = array(
            'Content-Type:text/json; charset=utf-8'
        );
    }

    /**
     *创建线上包裹
     *@param array $jsonData array('orders_id'=>'json')
     */
    public  function createAndConfirmPackages($jsonData){
        $logFileName = "ispApiGetMultiCurl".date("H",time());
        if($logFileName){
            Fn\App::log($logFileName,$jsonData,"万邑通请求TN Curl数据开始");
        }
        $multi_request_res=$this->multiCurl($jsonData);
        if($logFileName){
            Fn\App::log($logFileName,$multi_request_res,"万邑通请求TN Curl数据结束");
        }
        return $multi_request_res;
    }

    //api请求获取包裹标签pdf
    public  function createPackageLable($data){
        $url = $this->url;
        $headers = $this->header;
        $response = $this->oneHttpRequest($url,$data,'POST',$headers);
        return $response;
    }
}